<script  setup>
import {onBeforeMount, ref} from 'vue'
import { ElMessage } from 'element-plus'
import { Plus } from '@element-plus/icons-vue'

import axios from "axios";

const phone = ref('')

const username = ref('')

const adr_input = ref('')
const info_input = ref('')

onBeforeMount(()=>{

  axios.get("http://localhost:8090/getuserinfo").then((res) => {
    console.log(res)
    username.value=res.data
  })

})

</script>


<template>
  <div class="page-container">
    <div class="center-box">
      <h1 class="welcome-title">欢迎你登录本系统：{{ username }}</h1>
      <!-- 用户信息编辑表单 -->
      <form @submit.prevent="onSubmit">
        <div class="form-group">
          <label for="username">用户名</label>
          <input type="text" id="username" v-model="user.username" required />
        </div>
        <div class="form-group">
          <label for="email">邮箱</label>
          <input type="email" id="email" v-model="user.email" required />
        </div>
        <button type="submit">退出登录</button>
      </form>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: '用户昵称',
      user: {
        username: '用户昵称',
        email: 'user@example.com'
      }
    };
  },
  methods: {
    onSubmit() {
      // 表单提交的处理逻辑
      console.log('表单提交:', this.user);
      // 这里可以添加发送数据到服务器的代码
    }
  }
};
</script>

<style scoped>
.page-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
  background-color: #f0f0f0;
}

.center-box {
  width: 500px;
  padding: 20px; /* 减少内边距 */
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  max-height: 500px; /* 设置最大高度 */
  margin-top: -300px; /* 向上移动小框，可以根据需要调整这个值 */
  overflow-y: auto; /* 添加垂直滚动条 */
}

.welcome-title {
  font-size: 20px; /* 减小字体大小 */
  color: #333;
  margin-bottom: 20px; /* 减少标题与下方内容的间距 */
}

/* 响应式设计 */
@media (max-width: 768px) {
  .center-box {
    width: 90%;
  }

  .welcome-title {
    font-size: 18px; /* 在小屏幕上进一步减小字体大小 */
  }
}
</style>


<style scoped>
.avatar-uploader .avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>

<style>
.avatar-uploader .el-upload {
  border: 1px dashed var(--el-border-color);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--el-transition-duration-fast);
}

.avatar-uploader .el-upload:hover {
  border-color: var(--el-color-primary);
}

.el-icon.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  text-align: center;
}


.page-container {
  font-family: 'Arial', sans-serif;
}

.center-box {
  max-width: 600px;
  margin: 20px auto;
  padding: 20px;
  border: 1px solid #dee2e6;
  border-radius: 5px;
}

.welcome-title {
  text-align: center;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
}

.form-group input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

button {
  padding: 10px 20px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background-color: #0056b3;
}

</style>